﻿using System.Collections;

namespace SSISComponents.ReportGenerator
{
    public class RenderExtensions: Hashtable
    {
        public RenderExtensions()
        {
            this.Add("PDF", new RenderExtension("PDF", "*.pdf", "Acrobat"));
            this.Add("WORD", new RenderExtension("WORD", "*.doc", "Office Word"));
            this.Add("XML", new RenderExtension("XML", "*.xml", "XML file with report data"));
            this.Add("CSV", new RenderExtension("CSV", "*.csv", "Comma Delimited"));
            this.Add("HTML4.0", new RenderExtension("HTML4.0", "*.htm", "HTML 4.0"));
            this.Add("HTML", new RenderExtension("HTML4.0", "*.html", "HTML 4.0"));
            this.Add("MHTML", new RenderExtension("MHTML", "*.htm", "Web Archive"));
            this.Add("EXCEL", new RenderExtension("EXCEL", "*.xls", "Office Excel"));
            this.Add("IMAGE", new RenderExtension("IMAGE", "*.tiff", "TIFF file"));
        }

        public RenderExtension Get(string extension)
        {
            foreach (DictionaryEntry de in this)
            {
                RenderExtension re = (RenderExtension)de.Value;
                if (re.Extension.ToLower().Contains(extension.ToLower()))
                {
                    return re;
                }
            }
            return null;
        }
    }
}
